#name:home
#author:Yangwenwu
#@Time:2018/8/13 16:32
import xadmin
from UShop.models import (
    Brand,Sku,Skuimage,Specification,BuyCar,GainAdress,GoodsCar,TbGoods,TbGoodsCategory,TbPrder,
)

class BrandAdmin(object):
    list_display = ['br_id','br_name','br_logo','f_letter']
    search_fields = ['br_name']
    list_editable = ['f_letter']
    list_filter = ['br_id']


class SkuAdmin(object):
    list_display = ['sku_id','sku_name','sku_caption','sku_goods','sku_category','sku_price','sku_stock','sku_sales','is_sale']
    search_fields = ['sku_name']
    list_editable = ['sku_price','sku_stock0','sku_sales']
    list_filter = ['sku_stock','sku_category']
    # list_per_page = 20
    # list_max_show_all = 20


class SkuimageAdmin(object):
    list_display = ['ma_id','sku','ma_sku','ma_image']
    search_fields = ['ma_sku']
    list_editable = ['ma_sku']
    list_filter = ['ma_id']


class SpecificationAdmin(object):
    list_display = ['sp_id','sku','sp_spec','sp_option']
    search_fields = ['sku','sp_spec']
    list_editable = ['sp_spec','sp_option']
    list_filter = ['sp_spec']





class GoodsCarAdmin(object):
    list_display = ['buycar_id','goods','built_time']
    search_fields = ['built_time']
    # list_editable = ['buycar_id','goods','built_time']
    list_filter = ['built_time']


class TbGoodsAdmin(object):
    list_display = ['spu_id','sup_name','spu_code','spu_comment','spu_brand','spu_category']
    search_fields = ['sup_name', 'spu_brand']
    list_editable = ['spu_code', 'spu_comment','spu_brand','spu_category']
    list_filter = ['spu_category', 'spu_brand']


class TbGoodsCategoryAdmin(object):
    list_display = ['gd_id','gd_name']
    search_fields = ['gd_name']
    list_editable = ['gd_name']
    list_filter = ['gd_id']




xadmin.site.register(Brand, BrandAdmin)
xadmin.site.register(Sku, SkuAdmin)
xadmin.site.register(Skuimage, SkuimageAdmin)
xadmin.site.register(Specification, SpecificationAdmin)
xadmin.site.register(GoodsCar, GoodsCarAdmin)
xadmin.site.register(TbGoods, TbGoodsAdmin)
xadmin.site.register(TbGoodsCategory, TbGoodsCategoryAdmin)

